import {h, PolylineEdge, PolylineEdgeModel} from "@logicflow/core";
//折线
class PolylineLinkModel extends PolylineEdgeModel {
  getEdgeStyle() {
    const {strokeWidth} = this.properties
    const style = super.getEdgeStyle();
    style.stroke = this.isSelected ? '#ff7f0e' : '#999';
    if (strokeWidth){
      style.strokeWidth = strokeWidth
    }else {
      style.strokeWidth = 3
    }
    return style;
  }
  getEdgeAnimationStyle() {
    const {animationStroke} = this.properties
    const style = super.getEdgeAnimationStyle();
    style.strokeDasharray = "15 5";
    style.animationDuration = "10s";
    if (animationStroke) {
      style.stroke = animationStroke
    }else {
      style.stroke = 'rgb(130, 179, 102)'
    }
    return style;
  }
  setAttributes() {
    const pro = this.properties
    this.isAnimation = pro.isAnimation
  }
}

class PolylineLine extends PolylineEdge {

}

export default {
  type: 'polyline-link',
  view: PolylineLine,
  model: PolylineLinkModel
}
